package com.taotao.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

@Configuration
@PropertySource(value = "classpath:redis.properties")
public class RedisSpringConfig {

//    @Value("${redis.maxTotal}")
//    private Integer redisMaxTotal;

    @Value("${redis.node1.host}")
    private String redisNode1Host;

    @Value("${redis.node1.port}")
    private Integer redisNode1Port;
   @Bean
   @ConditionalOnMissingBean
   public JedisPool  jedisPool(){
	   JedisPool jedisPool=new JedisPool(redisNode1Host,redisNode1Port);
	   return jedisPool;
   }
}
